package com.wish.g1.house.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wish.g1.common.core.utils.DateUtils;
import com.wish.g1.house.entity.Housing;
import com.wish.g1.house.mapper.HousingMapper;
import com.wish.g1.house.service.IHousingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 楼盘表 服务实现类
 * </p>
 *
 * @author Dragon
 * @since 2022-11-18
 */
@Service
public class HousingServiceImpl extends ServiceImpl<HousingMapper, Housing> implements IHousingService {

    @Autowired
    private HousingMapper housingMapper;

    /**
     * 查询楼盘
     *
     * @param id 楼盘主键
     * @return 楼盘
     */
    @Override
    public Housing selectHousingById(Long id)
    {
        return housingMapper.selectHousingById(id);
    }
    /**
     * 查询楼盘列表
     *
     * @param housing 楼盘
     * @return 楼盘
     */
    @Override
    public List<Housing> selectHousingList(Housing housing)
    {
        return housingMapper.selectHousingList(housing);
    }

    /**
     * 新增楼盘
     *
     * @param housing 楼盘
     * @return 结果
     */
    @Override
    public int insertHousing(Housing housing)
    {
        housing.setCreateTime(DateUtils.getNowDate());
        return housingMapper.insertHousing(housing);
    }

    /**
     * 修改楼盘
     *
     * @param housing 楼盘
     * @return 结果
     */
    @Override
    public int updateHousing(Housing housing)
    {
        housing.setUpdateTime(DateUtils.getNowDate());
        return housingMapper.updateHousing(housing);
    }

    /**
     * 批量删除楼盘
     *
     * @param ids 需要删除的楼盘主键
     * @return 结果
     */
    @Override
    public int deleteHousingByIds(Long[] ids)
    {
        return housingMapper.deleteHousingByIds(ids);
    }

    /**
     * 删除楼盘信息
     *
     * @param id 楼盘主键
     * @return 结果
     */
    @Override
    public int deleteHousingById(Long id)
    {
        return housingMapper.deleteHousingById(id);
    }
}
